/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package missyrealestate;

import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;

/**
 *
 * @author Student
 */
public class PropertyEntry extends JFrame {

    JLabel jlCounty = new JLabel("County");
    JTextField jtfCounty = new JTextField();
    JLabel jlTaxID = new JLabel("Tax ID");
    JTextField jtfTaxID = new JTextField();
    JCheckBox jcbSingleFam = new JCheckBox("Single Family");
    JCheckBox jcbApartment = new JCheckBox("Apartment");
    JComboBox jcbPropertySubType = new JComboBox(new String[]{"Property Sub-Type",
                "Duplex", "Triplex", "Quad"
            });
    JLabel jlStreetNum = new JLabel("Street Number");
    JTextField jtfStreetNum = new JTextField();
    JLabel jlStreetName = new JLabel("Street Name");
    JTextField jtfStreetName = new JTextField();
    JComboBox jcbPostDir = new JComboBox(new String[]{"Post Direction", "North",
                "South", "East", "West"
            });
    JComboBox jcbSuffix = new JComboBox(new String[]{"Suffix", "Drive", "Road", "Street",
                "Avenue", "Court"
            });
    JLabel jlUnit = new JLabel("Unit Number");
    JTextField jtfUnit = new JTextField();
    JLabel jlCity = new JLabel("City/Municipality:");
    JTextField jtfCity = new JTextField();
    JLabel jlZipCode = new JLabel("ZipCode");
    JTextField jtfZipCode = new JTextField();
    JLabel jlCrossStreet = new JLabel("Cross Street");
    JTextField jtfCrossStreet = new JTextField();
    JLabel jlShowingInstr = new JLabel("Showing Instruction");
    JTextField jtfShowingInstr = new JTextField();
    JLabel jlPublicTrans = new JLabel("Public Transportation");
    JTextField jtfpublicTrans = new JTextField();
    JLabel jlLeaseAmount = new JLabel("Lease Amount");
    JTextField jtfLeaseAmount = new JTextField();
    JLabel jlLengthOfLease = new JLabel("Date Of Lease");
    JTextField jtfLengthOfLease = new JTextField();
    JComboBox jcbSecurityDeposit = new JComboBox(new String[]{"Security Deposit",
                "Yes", "No", "One Months Rent"
            });
    JComboBox jcbPetAllowed = new JComboBox(new String[]{"Pets Allowed", "Yes", "No"});
    JComboBox jcbPetRestriction = new JComboBox(new String[]{"Pet Restrictions", "Yes", "No"});
    JComboBox jcbExtraPetDeposit = new JComboBox(new String[]{"Extra Pet Deposit",
                "Yes", "No"
            });
    JLabel jbForSale = new JLabel("Option to buy House");
    JRadioButton jrbForSale = new JRadioButton("Yes");
    JRadioButton jrbSale = new JRadioButton("No");
    JTextField jtfPrice = new JTextField();
    private JButton jSave = new JButton("Save");

    public PropertyEntry() {

        JPanel p1 = new JPanel(new FlowLayout(FlowLayout.LEFT, 10, 20));
        JPanel p2 = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 20));
        JPanel p3 = new JPanel(new FlowLayout(FlowLayout.LEFT, 10, 20));
        JPanel p4 = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 20));
        JPanel p5 = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 20));
        JPanel p6 = new JPanel(new FlowLayout(FlowLayout.LEFT, 10, 20));
        JPanel p7 = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 20));
        JPanel p8 = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 20));
        JPanel p9 = new JPanel(new FlowLayout(FlowLayout.LEFT, 10, 20));
        JPanel p10 = new JPanel(null);




        setLayout(new GridLayout(12, 4, 5, 7));


        jSave.setBounds(10, 10, 300, 30);

        ButtonGroup group = new ButtonGroup();

        group.add(jrbSale);
        group.add(jrbForSale);


        p1.add(jlCounty);
        jtfCounty.setColumns(25);
        p1.add(jtfCounty);
        jtfTaxID.setColumns(30);
        p1.add(jlTaxID);
        p1.add(jtfTaxID);

        p2.add(jcbPropertySubType);
        p2.add(jcbSingleFam);
        p2.add(jcbApartment);
        
        jtfStreetNum.setColumns(20);
        p3.add(jlStreetNum);
        p3.add(jtfStreetNum);
        jtfStreetName.setColumns(10);
        p3.add(jlStreetName);
        p3.add(jtfStreetName);
        p3.add(jcbSuffix);
        p3.add(jcbPostDir);
        jtfUnit.setColumns(5);
        p3.add(jlUnit);
        p3.add(jtfUnit);
        
        jtfCity.setColumns(20);
        p4.add(jlCity);
        p4.add(jtfCity);
        jtfZipCode.setColumns(20);
        p4.add(jlZipCode);
        p4.add(jtfZipCode);
        
        jtfCrossStreet.setColumns(60);
        p5.add(jlCrossStreet);
        p5.add(jtfCrossStreet);
        
        jtfShowingInstr.setColumns(70);
        p6.add(jlShowingInstr);
        p6.add(jtfShowingInstr);
        
        jtfpublicTrans.setColumns(40);
        p7.add(jlPublicTrans);
        p7.add(jtfpublicTrans);

        jtfLeaseAmount.setColumns(10);
        p8.add(jlLeaseAmount);
        p8.add(jtfLeaseAmount);
        jtfLengthOfLease.setColumns(10);
        p8.add(jlLengthOfLease);
        p8.add(jtfLengthOfLease);

        p8.add(jcbSecurityDeposit);
        p8.add(jcbSecurityDeposit);

        p9.add(jcbPetAllowed);
        p9.add(jcbPetRestriction);
        p9.add(jcbExtraPetDeposit);
        p9.add(jbForSale);
        p9.add(jrbForSale);
        p9.add(jrbSale);
        jtfPrice.setColumns(10);
        p9.add(jtfPrice);

        p10.add(jSave);

        jtfPrice.setEnabled(false);
        jcbPetAllowed.setEnabled(true);

        add(p1);
        add(p2);
        add(p3);
        add(p4);
        add(p5);
        add(p6);
        add(p7);
        add(p8);
        add(p9);
        add(p10);


        jrbForSale.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                jtfPrice.setEnabled(true);
                repaint();
            }
        });


        jrbSale.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                jtfPrice.setEnabled(false);
                repaint();
            }
        });
    }
}
